package com.xiaomaoguai.user.action;

import java.util.Arrays;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.xiaomaoguai.user.model.AppDeveloper;
import com.xiaomaoguai.user.model.User;
import com.xiaomaoguai.user.service.AppDeveloperService;

/**
 * @Description :
 * @FileName: UserAction.java
 * @Author :WeiHui.Zhang
 * @Data : 2015年8月12日 下午2:48:11
 * @Version:V1.00
 */
@Controller
@RequestMapping(value = "user")
public class UserAction {

//	@Autowired
//	private UserService userService;

	@Autowired
	private AppDeveloperService appDeveloperService;

	@ResponseBody
	@RequestMapping(value = "json/{id}", method = { RequestMethod.GET, RequestMethod.POST })
	public List<User> toUserList(@PathVariable("id") Integer id) {
		User user = new User();
		user.setUserId(1);
		user.setUserName("zhang");
		User user2 = new User();
		user2.setUserId(2);
		user2.setUserName("张");

		AppDeveloper user3 = appDeveloperService.findById(id);

		AppDeveloper appDeveloper = appDeveloperService.selectByPrimaryKey(id);

		System.out.println(user3);

		System.out.println(appDeveloper);

		return Arrays.asList(user, user2);
	}
}
